<?php include_once "usuariosinfo.php" ?>
<?php

// Create page object
if (!isset($obras_grid)) $obras_grid = new cobras_grid();

// Page init
$obras_grid->Page_Init();

// Page main
$obras_grid->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$obras_grid->Page_Render();
?>
<?php if ($obras->Export == "") { ?>
<script type="text/javascript">

// Page object
var obras_grid = new ew_Page("obras_grid");
obras_grid.PageID = "grid"; // Page ID
var EW_PAGE_ID = obras_grid.PageID; // For backward compatibility

// Form object
var fobrasgrid = new ew_Form("fobrasgrid");
fobrasgrid.FormKeyCountName = '<?php echo $obras_grid->FormKeyCountName ?>';

// Validate form
fobrasgrid.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
		var checkrow = (gridinsert) ? !this.EmptyRow(infix) : true;
		if (checkrow) {
			addcnt++;
			felm = this.GetElements("x" + infix + "_Obra");
			elm = this.GetElements("fn_x" + infix + "_Obra");
			if (felm && elm && !ew_HasValue(elm))
				return this.OnError(felm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($obras->Obra->FldCaption()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
		} // End Grid Add checking
	}
	return true;
}

// Check empty row
fobrasgrid.EmptyRow = function(infix) {
	var fobj = this.Form;
	if (ew_ValueChanged(fobj, infix, "ObraArtista", false)) return false;
	if (ew_ValueChanged(fobj, infix, "ObraTitulo", false)) return false;
	if (ew_ValueChanged(fobj, infix, "Obra", false)) return false;
	if (ew_ValueChanged(fobj, infix, "ObraBio", false)) return false;
	if (ew_ValueChanged(fobj, infix, "ObraActiva[]", false)) return false;
	return true;
}

// Form_CustomValidate event
fobrasgrid.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fobrasgrid.ValidateRequired = true;
<?php } else { ?>
fobrasgrid.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fobrasgrid.Lists["x_ObraArtista"] = {"LinkField":"x_ArtistaId","Ajax":null,"AutoFill":false,"DisplayFields":["x_ArtistaNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};

// Form object for search
</script>
<?php } ?>
<?php if ($obras->getCurrentMasterTable() == "" && $obras_grid->ExportOptions->Visible()) { ?>
<div class="ewListExportOptions"><?php $obras_grid->ExportOptions->Render("body") ?></div>
<?php } ?>
<?php
if ($obras->CurrentAction == "gridadd") {
	if ($obras->CurrentMode == "copy") {
		$bSelectLimit = EW_SELECT_LIMIT;
		if ($bSelectLimit) {
			$obras_grid->TotalRecs = $obras->SelectRecordCount();
			$obras_grid->Recordset = $obras_grid->LoadRecordset($obras_grid->StartRec-1, $obras_grid->DisplayRecs);
		} else {
			if ($obras_grid->Recordset = $obras_grid->LoadRecordset())
				$obras_grid->TotalRecs = $obras_grid->Recordset->RecordCount();
		}
		$obras_grid->StartRec = 1;
		$obras_grid->DisplayRecs = $obras_grid->TotalRecs;
	} else {
		$obras->CurrentFilter = "0=1";
		$obras_grid->StartRec = 1;
		$obras_grid->DisplayRecs = $obras->GridAddRowCount;
	}
	$obras_grid->TotalRecs = $obras_grid->DisplayRecs;
	$obras_grid->StopRec = $obras_grid->DisplayRecs;
} else {
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$obras_grid->TotalRecs = $obras->SelectRecordCount();
	} else {
		if ($obras_grid->Recordset = $obras_grid->LoadRecordset())
			$obras_grid->TotalRecs = $obras_grid->Recordset->RecordCount();
	}
	$obras_grid->StartRec = 1;
	$obras_grid->DisplayRecs = $obras_grid->TotalRecs; // Display all records
	if ($bSelectLimit)
		$obras_grid->Recordset = $obras_grid->LoadRecordset($obras_grid->StartRec-1, $obras_grid->DisplayRecs);
}
$obras_grid->RenderOtherOptions();
?>
<?php $obras_grid->ShowPageHeader(); ?>
<?php
$obras_grid->ShowMessage();
?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div id="fobrasgrid" class="ewForm form-inline">
<div id="gmp_obras" class="ewGridMiddlePanel">
<table id="tbl_obrasgrid" class="ewTable ewTableSeparate">
<?php echo $obras->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$obras_grid->RenderListOptions();

// Render list options (header, left)
$obras_grid->ListOptions->Render("header", "left");
?>
<?php if ($obras->ObraId->Visible) { // ObraId ?>
	<?php if ($obras->SortUrl($obras->ObraId) == "") { ?>
		<td><div id="elh_obras_ObraId" class="obras_ObraId"><div class="ewTableHeaderCaption"><?php echo $obras->ObraId->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_ObraId" class="obras_ObraId">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->ObraId->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->ObraId->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->ObraId->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($obras->ObraArtista->Visible) { // ObraArtista ?>
	<?php if ($obras->SortUrl($obras->ObraArtista) == "") { ?>
		<td><div id="elh_obras_ObraArtista" class="obras_ObraArtista"><div class="ewTableHeaderCaption"><?php echo $obras->ObraArtista->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_ObraArtista" class="obras_ObraArtista">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->ObraArtista->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->ObraArtista->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->ObraArtista->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($obras->ObraTitulo->Visible) { // ObraTitulo ?>
	<?php if ($obras->SortUrl($obras->ObraTitulo) == "") { ?>
		<td><div id="elh_obras_ObraTitulo" class="obras_ObraTitulo"><div class="ewTableHeaderCaption"><?php echo $obras->ObraTitulo->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_ObraTitulo" class="obras_ObraTitulo">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->ObraTitulo->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->ObraTitulo->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->ObraTitulo->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($obras->Obra->Visible) { // Obra ?>
	<?php if ($obras->SortUrl($obras->Obra) == "") { ?>
		<td><div id="elh_obras_Obra" class="obras_Obra"><div class="ewTableHeaderCaption"><?php echo $obras->Obra->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_Obra" class="obras_Obra">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->Obra->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->Obra->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->Obra->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($obras->ObraBio->Visible) { // ObraBio ?>
	<?php if ($obras->SortUrl($obras->ObraBio) == "") { ?>
		<td><div id="elh_obras_ObraBio" class="obras_ObraBio"><div class="ewTableHeaderCaption"><?php echo $obras->ObraBio->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_ObraBio" class="obras_ObraBio">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->ObraBio->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->ObraBio->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->ObraBio->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($obras->ObraActiva->Visible) { // ObraActiva ?>
	<?php if ($obras->SortUrl($obras->ObraActiva) == "") { ?>
		<td><div id="elh_obras_ObraActiva" class="obras_ObraActiva"><div class="ewTableHeaderCaption"><?php echo $obras->ObraActiva->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_obras_ObraActiva" class="obras_ObraActiva">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $obras->ObraActiva->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($obras->ObraActiva->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($obras->ObraActiva->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$obras_grid->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
$obras_grid->StartRec = 1;
$obras_grid->StopRec = $obras_grid->TotalRecs; // Show all records

// Restore number of post back records
if ($objForm) {
	$objForm->Index = -1;
	if ($objForm->HasValue($obras_grid->FormKeyCountName) && ($obras->CurrentAction == "gridadd" || $obras->CurrentAction == "gridedit" || $obras->CurrentAction == "F")) {
		$obras_grid->KeyCount = $objForm->GetValue($obras_grid->FormKeyCountName);
		$obras_grid->StopRec = $obras_grid->StartRec + $obras_grid->KeyCount - 1;
	}
}
$obras_grid->RecCnt = $obras_grid->StartRec - 1;
if ($obras_grid->Recordset && !$obras_grid->Recordset->EOF) {
	$obras_grid->Recordset->MoveFirst();
	if (!$bSelectLimit && $obras_grid->StartRec > 1)
		$obras_grid->Recordset->Move($obras_grid->StartRec - 1);
} elseif (!$obras->AllowAddDeleteRow && $obras_grid->StopRec == 0) {
	$obras_grid->StopRec = $obras->GridAddRowCount;
}

// Initialize aggregate
$obras->RowType = EW_ROWTYPE_AGGREGATEINIT;
$obras->ResetAttrs();
$obras_grid->RenderRow();
if ($obras->CurrentAction == "gridadd")
	$obras_grid->RowIndex = 0;
if ($obras->CurrentAction == "gridedit")
	$obras_grid->RowIndex = 0;
while ($obras_grid->RecCnt < $obras_grid->StopRec) {
	$obras_grid->RecCnt++;
	if (intval($obras_grid->RecCnt) >= intval($obras_grid->StartRec)) {
		$obras_grid->RowCnt++;
		if ($obras->CurrentAction == "gridadd" || $obras->CurrentAction == "gridedit" || $obras->CurrentAction == "F") {
			$obras_grid->RowIndex++;
			$objForm->Index = $obras_grid->RowIndex;
			if ($objForm->HasValue($obras_grid->FormActionName))
				$obras_grid->RowAction = strval($objForm->GetValue($obras_grid->FormActionName));
			elseif ($obras->CurrentAction == "gridadd")
				$obras_grid->RowAction = "insert";
			else
				$obras_grid->RowAction = "";
		}

		// Set up key count
		$obras_grid->KeyCount = $obras_grid->RowIndex;

		// Init row class and style
		$obras->ResetAttrs();
		$obras->CssClass = "";
		if ($obras->CurrentAction == "gridadd") {
			if ($obras->CurrentMode == "copy") {
				$obras_grid->LoadRowValues($obras_grid->Recordset); // Load row values
				$obras_grid->SetRecordKey($obras_grid->RowOldKey, $obras_grid->Recordset); // Set old record key
			} else {
				$obras_grid->LoadDefaultValues(); // Load default values
				$obras_grid->RowOldKey = ""; // Clear old key value
			}
		} else {
			$obras_grid->LoadRowValues($obras_grid->Recordset); // Load row values
		}
		$obras->RowType = EW_ROWTYPE_VIEW; // Render view
		if ($obras->CurrentAction == "gridadd") // Grid add
			$obras->RowType = EW_ROWTYPE_ADD; // Render add
		if ($obras->CurrentAction == "gridadd" && $obras->EventCancelled && !$objForm->HasValue("k_blankrow")) // Insert failed
			$obras_grid->RestoreCurrentRowFormValues($obras_grid->RowIndex); // Restore form values
		if ($obras->CurrentAction == "gridedit") { // Grid edit
			if ($obras->EventCancelled) {
				$obras_grid->RestoreCurrentRowFormValues($obras_grid->RowIndex); // Restore form values
			}
			if ($obras_grid->RowAction == "insert")
				$obras->RowType = EW_ROWTYPE_ADD; // Render add
			else
				$obras->RowType = EW_ROWTYPE_EDIT; // Render edit
		}
		if ($obras->CurrentAction == "gridedit" && ($obras->RowType == EW_ROWTYPE_EDIT || $obras->RowType == EW_ROWTYPE_ADD) && $obras->EventCancelled) // Update failed
			$obras_grid->RestoreCurrentRowFormValues($obras_grid->RowIndex); // Restore form values
		if ($obras->RowType == EW_ROWTYPE_EDIT) // Edit row
			$obras_grid->EditRowCnt++;
		if ($obras->CurrentAction == "F") // Confirm row
			$obras_grid->RestoreCurrentRowFormValues($obras_grid->RowIndex); // Restore form values

		// Set up row id / data-rowindex
		$obras->RowAttrs = array_merge($obras->RowAttrs, array('data-rowindex'=>$obras_grid->RowCnt, 'id'=>'r' . $obras_grid->RowCnt . '_obras', 'data-rowtype'=>$obras->RowType));

		// Render row
		$obras_grid->RenderRow();

		// Render list options
		$obras_grid->RenderListOptions();

		// Skip delete row / empty row for confirm page
		if ($obras_grid->RowAction <> "delete" && $obras_grid->RowAction <> "insertdelete" && !($obras_grid->RowAction == "insert" && $obras->CurrentAction == "F" && $obras_grid->EmptyRow())) {
?>
	<tr<?php echo $obras->RowAttributes() ?>>
<?php

// Render list options (body, left)
$obras_grid->ListOptions->Render("body", "left", $obras_grid->RowCnt);
?>
	<?php if ($obras->ObraId->Visible) { // ObraId ?>
		<td<?php echo $obras->ObraId->CellAttributes() ?>>
<?php if ($obras->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-field="x_ObraId" name="o<?php echo $obras_grid->RowIndex ?>_ObraId" id="o<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->OldValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraId" class="control-group obras_ObraId">
<span<?php echo $obras->ObraId->ViewAttributes() ?>>
<?php echo $obras->ObraId->EditValue ?></span>
</span>
<input type="hidden" data-field="x_ObraId" name="x<?php echo $obras_grid->RowIndex ?>_ObraId" id="x<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->CurrentValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->ObraId->ViewAttributes() ?>>
<?php echo $obras->ObraId->ListViewValue() ?></span>
<input type="hidden" data-field="x_ObraId" name="x<?php echo $obras_grid->RowIndex ?>_ObraId" id="x<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->FormValue) ?>">
<input type="hidden" data-field="x_ObraId" name="o<?php echo $obras_grid->RowIndex ?>_ObraId" id="o<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->OldValue) ?>">
<?php } ?>
<a id="<?php echo $obras_grid->PageObjName . "_row_" . $obras_grid->RowCnt ?>"></a></td>
	<?php } ?>
	<?php if ($obras->ObraArtista->Visible) { // ObraArtista ?>
		<td<?php echo $obras->ObraArtista->CellAttributes() ?>>
<?php if ($obras->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<?php if ($obras->ObraArtista->getSessionValue() <> "") { ?>
<span<?php echo $obras->ObraArtista->ViewAttributes() ?>>
<?php echo $obras->ObraArtista->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_ObraArtista" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista"<?php echo $obras->ObraArtista->EditAttributes() ?>>
<?php
if (is_array($obras->ObraArtista->EditValue)) {
	$arwrk = $obras->ObraArtista->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($obras->ObraArtista->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $obras->ObraArtista->OldValue = "";
?>
</select>
<script type="text/javascript">
fobrasgrid.Lists["x_ObraArtista"].Options = <?php echo (is_array($obras->ObraArtista->EditValue)) ? ew_ArrayToJson($obras->ObraArtista->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<input type="hidden" data-field="x_ObraArtista" name="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" id="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->OldValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php if ($obras->ObraArtista->getSessionValue() <> "") { ?>
<span<?php echo $obras->ObraArtista->ViewAttributes() ?>>
<?php echo $obras->ObraArtista->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_ObraArtista" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista"<?php echo $obras->ObraArtista->EditAttributes() ?>>
<?php
if (is_array($obras->ObraArtista->EditValue)) {
	$arwrk = $obras->ObraArtista->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($obras->ObraArtista->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $obras->ObraArtista->OldValue = "";
?>
</select>
<script type="text/javascript">
fobrasgrid.Lists["x_ObraArtista"].Options = <?php echo (is_array($obras->ObraArtista->EditValue)) ? ew_ArrayToJson($obras->ObraArtista->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->ObraArtista->ViewAttributes() ?>>
<?php echo $obras->ObraArtista->ListViewValue() ?></span>
<input type="hidden" data-field="x_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->FormValue) ?>">
<input type="hidden" data-field="x_ObraArtista" name="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" id="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($obras->ObraTitulo->Visible) { // ObraTitulo ?>
		<td<?php echo $obras->ObraTitulo->CellAttributes() ?>>
<?php if ($obras->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraTitulo" class="control-group obras_ObraTitulo">
<input type="text" data-field="x_ObraTitulo" name="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($obras->ObraTitulo->PlaceHolder) ?>" value="<?php echo $obras->ObraTitulo->EditValue ?>"<?php echo $obras->ObraTitulo->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_ObraTitulo" name="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" value="<?php echo ew_HtmlEncode($obras->ObraTitulo->OldValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraTitulo" class="control-group obras_ObraTitulo">
<input type="text" data-field="x_ObraTitulo" name="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($obras->ObraTitulo->PlaceHolder) ?>" value="<?php echo $obras->ObraTitulo->EditValue ?>"<?php echo $obras->ObraTitulo->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->ObraTitulo->ViewAttributes() ?>>
<?php echo $obras->ObraTitulo->ListViewValue() ?></span>
<input type="hidden" data-field="x_ObraTitulo" name="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" value="<?php echo ew_HtmlEncode($obras->ObraTitulo->FormValue) ?>">
<input type="hidden" data-field="x_ObraTitulo" name="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" value="<?php echo ew_HtmlEncode($obras->ObraTitulo->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($obras->Obra->Visible) { // Obra ?>
		<td<?php echo $obras->Obra->CellAttributes() ?>>
<?php if ($obras_grid->RowAction == "insert") { // Add record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_Obra" class="control-group obras_Obra">
<span id="fd_x<?php echo $obras_grid->RowIndex ?>_Obra">
<span class="btn btn-small fileinput-button"<?php if ($obras->Obra->ReadOnly || $obras->Obra->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_Obra" name="x<?php echo $obras_grid->RowIndex ?>_Obra" id="x<?php echo $obras_grid->RowIndex ?>_Obra">
</span>
<input type="hidden" name="fn_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fn_x<?php echo $obras_grid->RowIndex ?>_Obra" value="<?php echo $obras->Obra->Upload->FileName ?>">
<input type="hidden" name="fa_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fa_x<?php echo $obras_grid->RowIndex ?>_Obra" value="0">
<input type="hidden" name="fs_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fs_x<?php echo $obras_grid->RowIndex ?>_Obra" value="50">
</span>
<table id="ft_x<?php echo $obras_grid->RowIndex ?>_Obra" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<input type="hidden" data-field="x_Obra" name="o<?php echo $obras_grid->RowIndex ?>_Obra" id="o<?php echo $obras_grid->RowIndex ?>_Obra" value="<?php echo ew_HtmlEncode($obras->Obra->OldValue) ?>">
<?php } elseif ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->Obra->ViewAttributes() ?>>
<?php if ($obras->Obra->LinkAttributes() <> "") { ?>
<?php if (!empty($obras->Obra->Upload->DbValue)) { ?>
<?php echo $obras->Obra->ListViewValue() ?>
<?php } elseif (!in_array($obras->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($obras->Obra->Upload->DbValue)) { ?>
<?php echo $obras->Obra->ListViewValue() ?>
<?php } elseif (!in_array($obras->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</span>
<?php } else  { // Edit record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_Obra" class="control-group obras_Obra">
<span id="fd_x<?php echo $obras_grid->RowIndex ?>_Obra">
<span class="btn btn-small fileinput-button"<?php if ($obras->Obra->ReadOnly || $obras->Obra->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_Obra" name="x<?php echo $obras_grid->RowIndex ?>_Obra" id="x<?php echo $obras_grid->RowIndex ?>_Obra">
</span>
<input type="hidden" name="fn_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fn_x<?php echo $obras_grid->RowIndex ?>_Obra" value="<?php echo $obras->Obra->Upload->FileName ?>">
<?php if (@$_POST["fa_x<?php echo $obras_grid->RowIndex ?>_Obra"] == "0") { ?>
<input type="hidden" name="fa_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fa_x<?php echo $obras_grid->RowIndex ?>_Obra" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fa_x<?php echo $obras_grid->RowIndex ?>_Obra" value="1">
<?php } ?>
<input type="hidden" name="fs_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fs_x<?php echo $obras_grid->RowIndex ?>_Obra" value="50">
</span>
<table id="ft_x<?php echo $obras_grid->RowIndex ?>_Obra" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($obras->ObraBio->Visible) { // ObraBio ?>
		<td<?php echo $obras->ObraBio->CellAttributes() ?>>
<?php if ($obras->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraBio" class="control-group obras_ObraBio">
<textarea data-field="x_ObraBio" name="x<?php echo $obras_grid->RowIndex ?>_ObraBio" id="x<?php echo $obras_grid->RowIndex ?>_ObraBio" cols="35" rows="6" placeholder="<?php echo ew_HtmlEncode($obras->ObraBio->PlaceHolder) ?>"<?php echo $obras->ObraBio->EditAttributes() ?>><?php echo $obras->ObraBio->EditValue ?></textarea>
</span>
<input type="hidden" data-field="x_ObraBio" name="o<?php echo $obras_grid->RowIndex ?>_ObraBio" id="o<?php echo $obras_grid->RowIndex ?>_ObraBio" value="<?php echo ew_HtmlEncode($obras->ObraBio->OldValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraBio" class="control-group obras_ObraBio">
<textarea data-field="x_ObraBio" name="x<?php echo $obras_grid->RowIndex ?>_ObraBio" id="x<?php echo $obras_grid->RowIndex ?>_ObraBio" cols="35" rows="6" placeholder="<?php echo ew_HtmlEncode($obras->ObraBio->PlaceHolder) ?>"<?php echo $obras->ObraBio->EditAttributes() ?>><?php echo $obras->ObraBio->EditValue ?></textarea>
</span>
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->ObraBio->ViewAttributes() ?>>
<?php echo $obras->ObraBio->ListViewValue() ?></span>
<input type="hidden" data-field="x_ObraBio" name="x<?php echo $obras_grid->RowIndex ?>_ObraBio" id="x<?php echo $obras_grid->RowIndex ?>_ObraBio" value="<?php echo ew_HtmlEncode($obras->ObraBio->FormValue) ?>">
<input type="hidden" data-field="x_ObraBio" name="o<?php echo $obras_grid->RowIndex ?>_ObraBio" id="o<?php echo $obras_grid->RowIndex ?>_ObraBio" value="<?php echo ew_HtmlEncode($obras->ObraBio->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($obras->ObraActiva->Visible) { // ObraActiva ?>
		<td<?php echo $obras->ObraActiva->CellAttributes() ?>>
<?php if ($obras->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraActiva" class="control-group obras_ObraActiva">
<div id="tp_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="{value}"<?php echo $obras->ObraActiva->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $obras->ObraActiva->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($obras->ObraActiva->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_ObraActiva" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $obras->ObraActiva->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $obras->ObraActiva->OldValue = "";
?>
</div>
</span>
<input type="hidden" data-field="x_ObraActiva" name="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="<?php echo ew_HtmlEncode($obras->ObraActiva->OldValue) ?>">
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $obras_grid->RowCnt ?>_obras_ObraActiva" class="control-group obras_ObraActiva">
<div id="tp_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="{value}"<?php echo $obras->ObraActiva->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $obras->ObraActiva->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($obras->ObraActiva->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_ObraActiva" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $obras->ObraActiva->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $obras->ObraActiva->OldValue = "";
?>
</div>
</span>
<?php } ?>
<?php if ($obras->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $obras->ObraActiva->ViewAttributes() ?>>
<?php echo $obras->ObraActiva->ListViewValue() ?></span>
<input type="hidden" data-field="x_ObraActiva" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva" value="<?php echo ew_HtmlEncode($obras->ObraActiva->FormValue) ?>">
<input type="hidden" data-field="x_ObraActiva" name="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="<?php echo ew_HtmlEncode($obras->ObraActiva->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$obras_grid->ListOptions->Render("body", "right", $obras_grid->RowCnt);
?>
	</tr>
<?php if ($obras->RowType == EW_ROWTYPE_ADD || $obras->RowType == EW_ROWTYPE_EDIT) { ?>
<script type="text/javascript">
fobrasgrid.UpdateOpts(<?php echo $obras_grid->RowIndex ?>);
</script>
<?php } ?>
<?php
	}
	} // End delete row checking
	if ($obras->CurrentAction <> "gridadd" || $obras->CurrentMode == "copy")
		if (!$obras_grid->Recordset->EOF) $obras_grid->Recordset->MoveNext();
}
?>
<?php
	if ($obras->CurrentMode == "add" || $obras->CurrentMode == "copy" || $obras->CurrentMode == "edit") {
		$obras_grid->RowIndex = '$rowindex$';
		$obras_grid->LoadDefaultValues();

		// Set row properties
		$obras->ResetAttrs();
		$obras->RowAttrs = array_merge($obras->RowAttrs, array('data-rowindex'=>$obras_grid->RowIndex, 'id'=>'r0_obras', 'data-rowtype'=>EW_ROWTYPE_ADD));
		ew_AppendClass($obras->RowAttrs["class"], "ewTemplate");
		$obras->RowType = EW_ROWTYPE_ADD;

		// Render row
		$obras_grid->RenderRow();

		// Render list options
		$obras_grid->RenderListOptions();
		$obras_grid->StartRowCnt = 0;
?>
	<tr<?php echo $obras->RowAttributes() ?>>
<?php

// Render list options (body, left)
$obras_grid->ListOptions->Render("body", "left", $obras_grid->RowIndex);
?>
	<?php if ($obras->ObraId->Visible) { // ObraId ?>
		<td>
<?php if ($obras->CurrentAction <> "F") { ?>
<?php } else { ?>
<span id="el$rowindex$_obras_ObraId" class="control-group obras_ObraId">
<span<?php echo $obras->ObraId->ViewAttributes() ?>>
<?php echo $obras->ObraId->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_ObraId" name="x<?php echo $obras_grid->RowIndex ?>_ObraId" id="x<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_ObraId" name="o<?php echo $obras_grid->RowIndex ?>_ObraId" id="o<?php echo $obras_grid->RowIndex ?>_ObraId" value="<?php echo ew_HtmlEncode($obras->ObraId->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($obras->ObraArtista->Visible) { // ObraArtista ?>
		<td>
<?php if ($obras->CurrentAction <> "F") { ?>
<?php if ($obras->ObraArtista->getSessionValue() <> "") { ?>
<span<?php echo $obras->ObraArtista->ViewAttributes() ?>>
<?php echo $obras->ObraArtista->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_ObraArtista" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista"<?php echo $obras->ObraArtista->EditAttributes() ?>>
<?php
if (is_array($obras->ObraArtista->EditValue)) {
	$arwrk = $obras->ObraArtista->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($obras->ObraArtista->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $obras->ObraArtista->OldValue = "";
?>
</select>
<script type="text/javascript">
fobrasgrid.Lists["x_ObraArtista"].Options = <?php echo (is_array($obras->ObraArtista->EditValue)) ? ew_ArrayToJson($obras->ObraArtista->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<?php } else { ?>
<span<?php echo $obras->ObraArtista->ViewAttributes() ?>>
<?php echo $obras->ObraArtista->ViewValue ?></span>
<input type="hidden" data-field="x_ObraArtista" name="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" id="x<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_ObraArtista" name="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" id="o<?php echo $obras_grid->RowIndex ?>_ObraArtista" value="<?php echo ew_HtmlEncode($obras->ObraArtista->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($obras->ObraTitulo->Visible) { // ObraTitulo ?>
		<td>
<?php if ($obras->CurrentAction <> "F") { ?>
<span id="el$rowindex$_obras_ObraTitulo" class="control-group obras_ObraTitulo">
<input type="text" data-field="x_ObraTitulo" name="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($obras->ObraTitulo->PlaceHolder) ?>" value="<?php echo $obras->ObraTitulo->EditValue ?>"<?php echo $obras->ObraTitulo->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_obras_ObraTitulo" class="control-group obras_ObraTitulo">
<span<?php echo $obras->ObraTitulo->ViewAttributes() ?>>
<?php echo $obras->ObraTitulo->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_ObraTitulo" name="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="x<?php echo $obras_grid->RowIndex ?>_ObraTitulo" value="<?php echo ew_HtmlEncode($obras->ObraTitulo->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_ObraTitulo" name="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" id="o<?php echo $obras_grid->RowIndex ?>_ObraTitulo" value="<?php echo ew_HtmlEncode($obras->ObraTitulo->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($obras->Obra->Visible) { // Obra ?>
		<td>
<span id="el$rowindex$_obras_Obra" class="control-group obras_Obra">
<span id="fd_x<?php echo $obras_grid->RowIndex ?>_Obra">
<span class="btn btn-small fileinput-button"<?php if ($obras->Obra->ReadOnly || $obras->Obra->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_Obra" name="x<?php echo $obras_grid->RowIndex ?>_Obra" id="x<?php echo $obras_grid->RowIndex ?>_Obra">
</span>
<input type="hidden" name="fn_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fn_x<?php echo $obras_grid->RowIndex ?>_Obra" value="<?php echo $obras->Obra->Upload->FileName ?>">
<input type="hidden" name="fa_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fa_x<?php echo $obras_grid->RowIndex ?>_Obra" value="0">
<input type="hidden" name="fs_x<?php echo $obras_grid->RowIndex ?>_Obra" id= "fs_x<?php echo $obras_grid->RowIndex ?>_Obra" value="50">
</span>
<table id="ft_x<?php echo $obras_grid->RowIndex ?>_Obra" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<input type="hidden" data-field="x_Obra" name="o<?php echo $obras_grid->RowIndex ?>_Obra" id="o<?php echo $obras_grid->RowIndex ?>_Obra" value="<?php echo ew_HtmlEncode($obras->Obra->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($obras->ObraBio->Visible) { // ObraBio ?>
		<td>
<?php if ($obras->CurrentAction <> "F") { ?>
<span id="el$rowindex$_obras_ObraBio" class="control-group obras_ObraBio">
<textarea data-field="x_ObraBio" name="x<?php echo $obras_grid->RowIndex ?>_ObraBio" id="x<?php echo $obras_grid->RowIndex ?>_ObraBio" cols="35" rows="6" placeholder="<?php echo ew_HtmlEncode($obras->ObraBio->PlaceHolder) ?>"<?php echo $obras->ObraBio->EditAttributes() ?>><?php echo $obras->ObraBio->EditValue ?></textarea>
</span>
<?php } else { ?>
<span id="el$rowindex$_obras_ObraBio" class="control-group obras_ObraBio">
<span<?php echo $obras->ObraBio->ViewAttributes() ?>>
<?php echo $obras->ObraBio->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_ObraBio" name="x<?php echo $obras_grid->RowIndex ?>_ObraBio" id="x<?php echo $obras_grid->RowIndex ?>_ObraBio" value="<?php echo ew_HtmlEncode($obras->ObraBio->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_ObraBio" name="o<?php echo $obras_grid->RowIndex ?>_ObraBio" id="o<?php echo $obras_grid->RowIndex ?>_ObraBio" value="<?php echo ew_HtmlEncode($obras->ObraBio->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($obras->ObraActiva->Visible) { // ObraActiva ?>
		<td>
<?php if ($obras->CurrentAction <> "F") { ?>
<span id="el$rowindex$_obras_ObraActiva" class="control-group obras_ObraActiva">
<div id="tp_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="{value}"<?php echo $obras->ObraActiva->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $obras_grid->RowIndex ?>_ObraActiva" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $obras->ObraActiva->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($obras->ObraActiva->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_ObraActiva" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $obras->ObraActiva->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $obras->ObraActiva->OldValue = "";
?>
</div>
</span>
<?php } else { ?>
<span id="el$rowindex$_obras_ObraActiva" class="control-group obras_ObraActiva">
<span<?php echo $obras->ObraActiva->ViewAttributes() ?>>
<?php echo $obras->ObraActiva->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_ObraActiva" name="x<?php echo $obras_grid->RowIndex ?>_ObraActiva" id="x<?php echo $obras_grid->RowIndex ?>_ObraActiva" value="<?php echo ew_HtmlEncode($obras->ObraActiva->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_ObraActiva" name="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" id="o<?php echo $obras_grid->RowIndex ?>_ObraActiva[]" value="<?php echo ew_HtmlEncode($obras->ObraActiva->OldValue) ?>">
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$obras_grid->ListOptions->Render("body", "right", $obras_grid->RowCnt);
?>
<script type="text/javascript">
fobrasgrid.UpdateOpts(<?php echo $obras_grid->RowIndex ?>);
</script>
	</tr>
<?php
}
?>
</tbody>
</table>
<?php if ($obras->CurrentMode == "add" || $obras->CurrentMode == "copy") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridinsert">
<input type="hidden" name="<?php echo $obras_grid->FormKeyCountName ?>" id="<?php echo $obras_grid->FormKeyCountName ?>" value="<?php echo $obras_grid->KeyCount ?>">
<?php echo $obras_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($obras->CurrentMode == "edit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="<?php echo $obras_grid->FormKeyCountName ?>" id="<?php echo $obras_grid->FormKeyCountName ?>" value="<?php echo $obras_grid->KeyCount ?>">
<?php echo $obras_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($obras->CurrentMode == "") { ?>
<input type="hidden" name="a_list" id="a_list" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="fobrasgrid">
</div>
<?php

// Close recordset
if ($obras_grid->Recordset)
	$obras_grid->Recordset->Close();
?>
<?php if ($obras_grid->ShowOtherOptions) { ?>
<div class="ewGridLowerPanel ewListOtherOptions">
<?php
	foreach ($obras_grid->OtherOptions as &$option)
		$option->Render("body", "bottom");
?>
</div>
<?php } ?>
</div>
</td></tr></table>
<?php if ($obras->Export == "") { ?>
<script type="text/javascript">
fobrasgrid.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php } ?>
<?php
$obras_grid->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<?php
$obras_grid->Page_Terminate();
?>
